Only write a success node when coming online, not going offline. Delete the
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Fri, 25 Nov 2005 17:12:12 +0000 (17:12 +0000)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Fri, 25 Nov 2005 17:12:12 +0000 (17:12 +0000)
interface from the bridge when going offline -- the comment stating that
interfaces are auto-removed does not seem to be true, at least some of the
time.  Log failure of brctl delif and ifconfig down only at debug level, as
this script may be called more than once, depending upon the hotplug
configuration.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/examples/vif-bridge

index 69f1a670d7862fcb68afb0871ecaad6dea3009cc..5144339498efc27acd93c66b725ceacdf8eeaf1d 100755 (executable)
@@ -61,12 +61,16 @@ case "$command" in
         ;;
 
     offline)
-        # vifs are auto-removed from bridge.
-        ifconfig "$vif" down || log err "ifconfig $vif down failed"
+        brctl delif "$bridge" "$vif" ||
+          log debug "brctl delif $bridge $vif failed"
+        ifconfig "$vif" down || log debug "ifconfig $vif down failed"
         ;;
 esac
 
 handle_iptable
 
-log debug "Successful vif-bridge operation for $vif, bridge $bridge."
-success
+log debug "Successful vif-bridge $command for $vif, bridge $bridge."
+if [ "$command" == "online" ]
+then
+  success
+fi